﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LEDDisplay.SDK
{
    public class LEDDisplayDriver
    {
        private static object locker = new object();
        public static string On(string ip)
        {
            lock (locker)
            {
                int ret = LEDDisplaySDK.Set_NetPara(1, ip, -1, -1);
                if (ret != 1) { return TurnRet(ret); }
                ret = LEDDisplaySDK.Net_Command(1, 3);
                return TurnRet(ret);
            }
        }
        public static string Off(string ip)
        {
            lock (locker)
            {
                int ret = LEDDisplaySDK.Set_NetPara(1, ip, -1, -1);
                if (ret != 1) { return TurnRet(ret); }
                ret = LEDDisplaySDK.Net_Command(1, 4);
                return TurnRet(ret);
            }
        }

        public static string TurnRet(int ret)
        {
            switch(ret)
	        {
	        case 0 : return "设置失败"; 
	        case 1 : return "操作成功"; 	
	        case 2 : return "通讯失败"; 	
	        case 3 : return "操作失败";	
	        }
            return "未知错误";
        }
    }
}
